package com.ice.ainit;

import org.testng.annotations.Test;

import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;

import static com.ice.ainit.JdbcColumnModelType.*;

public class JdbcDone {
    private String PACKAGE_NAME = "business";//项目包名
    private String TABLE_NAME = "t_reagent_use";//表名
    private String ANNOTATION_NAME = "危化品使用记录";//表名对应中文
    private String MENU_PARENT_NAME = "危化品使用记录";//父级菜单名称
    JdbcUtils jdbcUtils = new JdbcUtils(PACKAGE_NAME, TABLE_NAME, ANNOTATION_NAME, MENU_PARENT_NAME);

    /**
     * 初始化数据库信息，包括创建数据库
     */
    @Test
    public void initDataBase() throws SQLException {
        jdbcUtils.initDateInfo();
    }

    @Test
    public void done() throws IOException, SQLException {
        ArrayList<JdbcColumnModel> init = new ArrayList<>();
        init.add(new JdbcColumnModel("id", LONGTEXT, "20", "id"));
        init.add(new JdbcColumnModel("pid", LONGTEXT, "20", "父id"));
        init.add(new JdbcColumnModel("userName", VARCHAR, "20", "使用人"));
        init.add(new JdbcColumnModel("orderNo", VARCHAR, "32", "订单号"));
        init.add(new JdbcColumnModel("usage", VARCHAR, "16", "用量"));

        init.add(new JdbcColumnModel("createTime", DATETIME, "1", "创建时间"));

        jdbcUtils.doMain(init, true, false, true);
    }


}
